/**
 * Copyright(c) ${copyrightYear} ${company}
 * All rights reserved.
 * Created on ${date}
 */
package ${package}.dao;

import org.springframework.stereotype.Repository;
import ${package}.BaseDAO;
import ${package}.entity.UserEntity;
import java.sql.SQLException;

/**
 * 用户DAO
 * 
 * @author ${author}
 * 
 */
@Repository("userDAO")
public final class UserDAO extends BaseDAO<UserEntity> {
    /**
     * 根据用户名查找用户 语句
     */
    private final static String FIND_USER_BY_USERNAME_HQL="from UserEntity where username=:username";
    /**
     * 根据用户名查找用户
     * @param username
     * @return
     * @throws SQLException 所有SQL异常
     */
    public UserEntity findUserByUsername(String username) throws SQLException {
        return uniqueResult(FIND_USER_BY_USERNAME_HQL, "username", username);
    }
}
 